/*
JuffEd - A simple text editor
Copyright 2007 Murzin Mikhail

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License 
version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef _NULLTEXT_DOC_H_
#define _NULLTEXT_DOC_H_

#include "TextDoc.h"

class NullTextDoc : public TextDoc {
public:

	static NullTextDoc* instance() {
		if (doc_ == 0)
			doc_ = new NullTextDoc();
		return doc_;
	}

	virtual ~NullTextDoc() { }

	//	methods of parent class Document
	virtual bool isNull() const { return true; }
	virtual QWidget* widget() const { scream(); return 0; }
	virtual void applySettings() { scream(); }
	virtual bool save() { scream(); return false; }
	virtual bool saveAs(const QString&) { scream(); return false; }
	virtual bool isModified() { scream(); return false; }

	//	methods of parent class TextDoc
	virtual int lineCount() const { scream(); return 0; }
	virtual void cut() { scream(); }
	virtual void copy() { scream(); }
	virtual void paste() { scream(); }
	virtual void undo() { scream(); }
	virtual void redo() { scream(); }
	virtual void setCharset(const QString&) { scream(); }
	virtual void find(const QString&, bool, bool) { scream(); }
	virtual void gotoLine(int) { scream(); }
	virtual void getCursorPos(int&, int&) { scream(); }

private:
	NullTextDoc() : TextDoc("", 0) { }

	void scream() const {
		qDebug("NULL document requested");
	}

	static NullTextDoc* doc_;
};

NullTextDoc* NullTextDoc::doc_ = 0;

#endif
